import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '@/views/login'
import Layout from '@/views/layout'
import Question from '@/views/question'
import Video from '@/views/video'
import Users from '@/views/users'
import Home from '@/views/home'
Vue.use(VueRouter)
const routes = [
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/',
    name: 'layout',
    component: Layout,
    children: [
      {
        path: '',
        name: 'home',
        component: Home
      },
      {
        path: '/question',
        name: 'question',
        component: Question
      },
      {
        path: '/video',
        name: 'video',
        component: Video
      },
      {
        path: '/users',
        name: 'users',
        component: Users
      }
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/search/index')
  },
  {
    path: '/search/result',
    name: 'result',
    component: () => import('../views/search/result')
  },
  {
    path: '/article/:id',
    component: () => import('../views/article/index')
  },
  {
    path: '/user/profile',
    name: 'userProfile',
    component: () => import('@/views/users/profile.vue')
  },
  {
    path: '/user/chat',
    component: () => import('@/views/users/chat')
  }
]
const router = new VueRouter({
  routes
})
export default router
